class GoodDetailVo {

  GoodDetailData? data;

  GoodDetailVo({this.data});

  GoodDetailVo.fromJson(Map<String, dynamic> json) {
    data = json['data'] != null ? new GoodDetailData.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.toJson();
    }
    return data;
  }
}

class GoodDetailData {
  int? id;
  String? productSn;
  int? categoryId;
  String? category;
  String? thumbnail;
  List<String>? images;
  String? title;
  String? marketPrice;
  String? price;
  int? stock;
  int? sales;
  String? description;
  int? pickType;
  List<Attributes>? attributes;
  List<SkuItem>? skus;
  int? integral;
  String? dispatchingFee;

  GoodDetailData(
      {this.id,
      this.productSn,
      this.categoryId,
      this.category,
      this.thumbnail,
      this.images,
      this.title,
      this.marketPrice,
      this.price,
      this.stock,
      this.sales,
      this.description,
      this.attributes,
      this.skus,
      this.integral,
      this.pickType,
      this.dispatchingFee});

  GoodDetailData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    productSn = json['product_sn'];
    categoryId = json['category_id'];
    category = json['category'];
    thumbnail = json['thumbnail'];
    images = json['images'].cast<String>();
    title = json['title'];
    marketPrice = json['market_price'];
    price = json['price'];
    stock = json['stock'];
    sales = json['sales'];
    description = json['description'];
    integral = json['integral'];
    pickType = json['pick_type'];
    dispatchingFee = json['dispatching_fee'];
    if (json['attributes'] != null) {
      attributes = [];
      json['attributes'].forEach((v) {
        attributes!.add(new Attributes.fromJson(v));
      });
    }
    if (json['skus'] != null) {
      skus = [];
      json['skus'].forEach((v) {
        skus!.add(new SkuItem.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['product_sn'] = this.productSn;
    data['category_id'] = this.categoryId;
    data['category'] = this.category;
    data['thumbnail'] = this.thumbnail;
    data['images'] = this.images;
    data['title'] = this.title;
    data['market_price'] = this.marketPrice;
    data['price'] = this.price;
    data['stock'] = this.stock;
    data['sales'] = this.sales;
    data['description'] = this.description;
    data['integral'] = this.integral;
    data['pick_type'] = this.pickType;
    data['dispatching_fee'] = this.dispatchingFee;
    if (this.attributes != null) {
      data['attributes'] = this.attributes!.map((v) => v.toJson()).toList();
    }
    if (this.skus != null) {
      data['skus'] = this.skus!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Attributes {
  int? id;
  String? title;
  List<SpecItem>? specs;

  Attributes({this.id, this.title, this.specs});

  Attributes.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    title = json['title'];
    if (json['specs'] != null) {
      specs = [];
      json['specs'].forEach((v) {
        specs!.add(new SpecItem.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['title'] = this.title;
    if (this.specs != null) {
      data['specs'] = this.specs!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class SpecItem {
  int? attrId;
  int? id;
  String? title;

  SpecItem({this.attrId, this.id, this.title});

  SpecItem.fromJson(Map<String, dynamic> json) {
    attrId = json['attr_id'];
    id = json['id'];
    title = json['title'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['attr_id'] = this.attrId;
    data['id'] = this.id;
    data['title'] = this.title;
    return data;
  }
}

class SkuItem {
  int? id;
  String? image;
  String? price;
  String? specIds;
  String? specStr;
  int? stock;
  int? quantity;
  int? integral;

  SkuItem({this.image, this.price, this.specIds, this.specStr, this.stock});

  SkuItem.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    image = json['image'];
    price = json['price'];
    specIds = json['spec_ids'];
    specStr = json['spec_str'];
    stock = json['stock'];
    quantity = json['quantity'];
    integral = json['integral'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['image'] = this.image;
    data['price'] = this.price;
    data['spec_ids'] = this.specIds;
    data['spec_str'] = this.specStr;
    data['stock'] = this.stock;
    data['quantity'] = this.quantity;
    data['integral'] = this.integral;
    return data;
  }
}
